package com.exp.sys.action;

import javax.annotation.Resource;

import org.apache.commons.collections.MapUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import tk.mybatis.mapper.entity.Example;

import com.exp.base.action.DataTablesPage;
import com.exp.base.action.DataTablesPageInfo;
import com.exp.base.action.EasyuiPage;
import com.exp.base.action.EasyuiPageInfo;
import com.exp.sys.entity.Admin;
import com.exp.sys.service.AdminService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;

@Controller
@RequestMapping("/sys/test")
public class TestAction extends BaseAction {
	@Resource
	AdminService adminDomain;

	
	@RequestMapping("list")
	public String table(){
		return "sys/test/list";
	}

	@ResponseBody
	@RequestMapping("query")
	public EasyuiPageInfo query(Model model,EasyuiPage easyuiPage){
		Page<Admin> page = new Page<Admin>(easyuiPage.getPage(), easyuiPage.getRows());
		PageInfo<Admin> pageInfo = adminDomain.query(new Example(Admin.class), page);
		EasyuiPageInfo easyuiPageInfo = new EasyuiPageInfo(pageInfo);
		return easyuiPageInfo;
	}
	
	
}
